import 'package:flutter_base_app/config/status_bar.dart';
import 'package:flutter_base_app/config/theme.dart';
import 'package:flutter_base_app/export.dart';
import 'package:flutter_base_app/router/routes_manager.dart';
import 'package:flutter/material.dart';
import 'package:flutter_base_framework/base_framework_export.dart';
import 'package:flutter_common_utils/common_utils_export.dart';

import '../vm/welcome_vm.dart';

///
class WelcomePage extends BasePage {
  const WelcomePage({super.key});

  @override
  State<WelcomePage> createState() => _WelcomePageState();
}

class _WelcomePageState extends BaseMvvmState<WelcomePage, WelcomeVm> {
  _WelcomePageState() : super(WelcomeVm());

  @override
  void initState() {
    super.initState();
    title.value = "Welcome";
    StatusBar.setWelcomeStatusBar();
    // 使用 addPostFrameCallback 确保导航发生在下一帧
    // WidgetsBinding.instance.addPostFrameCallback((_) {
    // });
    launchSJ((s, j) async {
      await delayFuture(2);
      RouterJump.main();
      // if (UserHelp.isLogin) {
      //   AppRouterJump.main();
      // } else {
      //   UserHelp.login();
      // }
    });
  }

  @override
  Widget buildWidget(BuildContext context) {
    return Scaffold(
      backgroundColor: ColorsApp.page_background,
    );
    // return Column(
    //   mainAxisAlignment: MainAxisAlignment.center,
    //   crossAxisAlignment: CrossAxisAlignment.center,
    //   children: <Widget>[
    //     SvgWidget(
    //       Assets.svgMainIcLogoText,
    //       width: 100,
    //       height: 100,
    //     ),
    //     const SizedBox(
    //       height: 20,
    //     ),
    //   ],
    // );
  }
}
